package com.jec.module.sysconfig.service.configor;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Component;

import com.jec.module.sysconfig.dao.RelayBusinessRepository;
import com.jec.module.sysconfig.entity.RelayBusiness;
import com.jec.module.sysconfig.service.convertor.Convertor;
import com.jec.module.sysconfig.service.convertor.RelayBusinessConvertor;

@Component
public class RelayBusinessConfigor extends BaseConfigor<RelayBusiness> {
	
	@Autowired
	private RelayBusinessRepository relayBusinessRepository;
	
	@Autowired 
	private RelayBusinessConvertor relayBusinessConvertor;	
	
	public RelayBusinessConfigor() {
		logKey = "中继业务";
	}

	@Override
	protected JpaRepository<RelayBusiness, Integer> getRepository() {
		return relayBusinessRepository;
	}

	@Override
	protected Convertor<RelayBusiness> getConvertor() {
		return relayBusinessConvertor;
	}

	@Override
	public boolean hasConfigOnNetunit(int netunit) {
		return !relayBusinessRepository.findAllByNetunit(netunit).isEmpty();
	}
}
